package com.allwees.bs.module.ics.wf;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.allwees.core.wf.FsmState;
import com.allwees.core.wf.Transition;

import java.util.Arrays;
import java.util.List;

public enum EIcsOfferState implements FsmState<EIcsOfferState, EIcsOfferAction>, IEnum<String> {
    START("Start", false, false) {
        @Override
        public List<Transition<EIcsOfferState, EIcsOfferAction>> getTransitions() {
            return Arrays.asList(
                    new Transition<>(NEW_PROPOSALS)
            );
        }
    },

    NEW_PROPOSALS("Contact", true, false) {
        @Override
        public List<Transition<EIcsOfferState, EIcsOfferAction>> getTransitions() {
            return Arrays.asList(
                    new Transition<>(EIcsOfferAction.SIGN, COMPLETED)
            );
        }
    },

    CANCELED("Canceled", false, true),

    COMPLETED("Completed", false, true);;

    private String desc;

    private boolean started;

    private boolean ended;

    EIcsOfferState(String desc, boolean started, boolean ended) {
        this.desc = desc;
        this.started = started;
        this.ended = ended;
    }

    @Override
    public String getValue() {
        return desc;
    }

    @Override
    public boolean started() {
        return started;
    }

    @Override
    public boolean ended() {
        return ended;
    }
}
